home *** CD-ROM | disk | FTP | other *** search
- <xsl:stylesheet version='1.0'
- xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
- >
-
- <xsl:output method="text"/>
-
- <xsl:template match="/">
- <xsl:variable name="node1" select="/cities/city[3]"/>
- <xsl:variable name="node2" select="/cities/city[2]"/>
-
- <xsl:text>"</xsl:text>
- <xsl:value-of select="$node1"/>
- <xsl:text>"</xsl:text>
- <xsl:text> is</xsl:text>
-
- <xsl:call-template name="node-stringCompare">
- <xsl:with-param name="node1" select="$node1"/>
- <xsl:with-param name="node2" select="$node2"/>
- </xsl:call-template>
-
- <xsl:text>"</xsl:text>
- <xsl:value-of select="$node2"/>
- <xsl:text>"</xsl:text>
- </xsl:template>
-
- <xsl:template name="node-stringCompare">
- <xsl:param name="node1"/>
- <xsl:param name="node2"/>
-
- <xsl:choose>
- <xsl:when test="string($node1)=string($node2)">
- <xsl:text> equal to </xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="$node1 | $node2">
- <xsl:sort select="."/>
-
- <xsl:if test="position()=1">
- <xsl:choose>
- <xsl:when test="string(.) = string($node1)">
- <xsl:text> less than </xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text> greater than </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:template>
- </xsl:stylesheet>
-